home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / amigem.lha / amigem / exec / machine.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-02  |  1.0 KB  |  62 lines

  1. #include <exec/execbase.h>
  2. #include <exec/tasks.h>
  3.  
  4. /* This one's really machine dependant ;-) */
  5.  
  6. #include <amigem/fd_lib.h>
  7. #define LIBBASE struct ExecBase *SysBase
  8.  
  9. FD1(122,VOID,StackSwap,struct StackSwapStruct *newStack,A0)
  10. ; /* For generating headers and fd-file, etc. */
  11.  
  12. asm("
  13.     .globl ___StackSwap
  14. ___StackSwap:
  15.     jbsr    a6@(120:W)        | Disable
  16.     movel    sp@+,d0            | pop returnaddress
  17.     movel    a6@(276:W),a1        | get task address
  18.     addaw    #58,a1
  19.     movel    a0@,d1            | swap stk_Lower
  20.     movel    a1@,a0@+
  21.     movel    d1,a1@+
  22.     movel    a0@,d1            | swap stk_Upper
  23.     movel    a1@,a0@+
  24.     movel    d1,a1@
  25.     movel    a0@,d1            | swap stk_Pointer
  26.     movel    sp,a0@
  27.     movel    d1,sp
  28.     movel    d0,sp@-            | push returnaddress
  29.     jbsr    a6@(126:W)        | Enable
  30.     rts                | ciao
  31.  
  32.     .globl _stuffChar
  33. _stuffChar:
  34.     movel    a3,a7@-
  35.     movel    a7@(16:W),a3
  36.     movel    a7@(12:W),d0
  37.     movel    a7@(8:W),a0
  38.     jsr    a0@
  39.     movel    a3,d0
  40.     movel    a7@+,a3
  41.     rts
  42.  
  43.     .globl    _putChar
  44. _putChar:
  45.     moveb    d0,a3@+
  46.     rts
  47.  
  48.     .globl _DivMod10
  49. _DivMod10:
  50.     clrl    d1
  51.     movew    a7@(4:W),d1
  52.     divu    #10:W,d1
  53.     movew    d1,d0
  54.     swap    d0
  55.     movew    a7@(6:W),d1
  56.     divu    #10:W,d1
  57.     movew    d1,d0
  58.     clrw    d1
  59.     swap    d1
  60.     rts
  61. ");
  62.